//============================================================================
// Name        : JedisSuite.java
// Author      : iron.yin@gmail.com
// Version     : v1.0
// Copyright   : RisingSun CO,.LTD
// Description : JedisSuite.java in Java
//============================================================================
package cc.risingsun.wing.test;

import java.util.List;

import org.junit.Before;
import org.junit.Test;

import redis.clients.jedis.JedisPoolConfig;
import redis.clients.jedis.JedisShardInfo;
import redis.clients.jedis.ShardedJedis;
import redis.clients.jedis.ShardedJedisPool;
import cc.risingsun.wing.ds.DataStruct;

/**
 *
 *@author iron.yin@gmail.com
 */
public class JedisTestSuite {

	JedisPoolConfig poolConfig;
	
	List<JedisShardInfo> shards;
	
	public void initConfig(){
		poolConfig = new JedisPoolConfig();
		poolConfig.setMaxActive(20);
		poolConfig.setMaxIdle(10);
		poolConfig.setMaxWait(1000);
		poolConfig.setTestOnBorrow(true);
	}
	
	@Before
	public void initShards(){
		shards = DataStruct.arrayList();
		JedisShardInfo info = new JedisShardInfo("127.0.0.1");
		shards.add(info);
	}
	
	
	@Test
	public void sharded(){
		ShardedJedisPool pool = new ShardedJedisPool(poolConfig, shards);
		ShardedJedis jedis = pool.getResource();
	}
	
}
